<template>
    <require from="./em-task-create-modal.less"></require>
    <em-modal classes="em-task-create-modal" em-modal.ref="emModal" onshow.call="showHandler($event)" onapprove.call="approveHandler($event)">
        <div slot="header">创建问题</div>
        <div slot="content">
            <div class="ui form" ref="form">
                <div class="inline field required">
                    <label>项目</label>
                    <em-dropdown label="name" name="project" value="id" items.bind="projects" selected.bind="task.project" onchange.call="projectChangeHandler($event)"></em-dropdown>
                </div>
                <div class="inline field required">
                    <label>问题类型</label>
                    <em-dropdown items.bind="types" selected.bind="task.type"></em-dropdown>
                </div>
                <div class="ui divider"></div>
                <div class="inline field required">
                    <label>主题</label>
                    <input style="width: 500px;" type="text" name="title" value.bind="task.title">
                </div>
                <div class="inline field required">
                    <label>优先级</label>
                    <em-dropdown items.bind="priorities" selected.bind="task.priority"></em-dropdown>
                </div>
                <div class="inline field">
                    <label>模块</label>
                    <em-dropdown classes="multiple search selection longer" label="name" value="id" items.bind="modules" selected.bind="task.module"></em-dropdown>
                </div>
                <div class="inline field">
                    <label>标签</label>
                    <div ref="labelsRef" class="ui multiple search selection dropdown longer">
                        <input type="hidden" name="labels">
                        <i class="dropdown icon"></i>
                        <div class="default text"></div>
                        <div class="menu">
                            <div repeat.for="item of labels" task.bind="initLabelsUI($last)" class="item" data-value="${item.name}">
                                ${item.name}
                            </div>
                        </div>
                    </div>
                </div>
                <div class="inline field">
                    <label>影响版本</label>
                    <em-dropdown classes="multiple search selection longer" label="name" value="id" items.bind="versions" selected.bind="task.effectVersion"></em-dropdown>
                </div>
                <div class="inline field">
                    <label>解决版本</label>
                    <em-dropdown classes="multiple search selection longer" label="name" value="id" items.bind="versions" selected.bind="task.resolvedVersion"></em-dropdown>
                </div>
                <div class="inline field">
                    <label>经办人</label>
                    <em-dropdown classes="search selection longer" items.bind="memmbers" label="name" value="username" selected.bind="task.operator"></em-dropdown>
                </div>
                <div class="inline field">
                    <label>描述</label>
                    <em-markdown-editor view-model.ref="descEditorVm"></em-markdown-editor>
                    <!-- <textarea style="width: 400px;" rows="6" value.bind="task.desc"></textarea> -->
                </div>
                <div class="inline field">
                    <label>附件</label>
                    <em-file-upload view-model.ref="fileUploadVm"></em-file-upload>
                </div>
            </div>
        </div>
    </em-modal>
</template>
